package realQuestion.min;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main1 {
    public  static  double max_point=Integer.MIN_VALUE;
    public  static  List<List<Integer>>   ans=new ArrayList<>();
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        String[] split = next.split(",");
        int towerlength=Integer.valueOf(split[0]);
        int radius=Integer.valueOf(split[1]);
        int[] x=new int[towerlength];
        int[] y=new  int[towerlength];
        int[] q=new int[towerlength];
  int max_x=Integer.MIN_VALUE,max_y=Integer.MIN_VALUE,min_x=Integer.MAX_VALUE,min_y=Integer.MAX_VALUE;
        for (int i = 0; i < towerlength; i++) {
            String next1 = scanner.next();
            String[] split1 = next1.split(",");
            x[i]=Integer.valueOf(split1[0]);
            y[i]=Integer.valueOf(split1[1]);
            q[i]=Integer.valueOf(split1[2]);

            max_x=Math.max(max_x,x[i])+radius;
            min_x=Math.min(min_x,x[i])-radius;

            max_y=Math.max(max_y,y[i])+radius;
            min_x=Math.min(min_x,y[i])-radius;
        }

        for (int m = min_x; m <max_x ; m++) {
            for (int n=min_y;n<min_y;n++){
                qiangdu(m,n,towerlength,radius,x,y,q);
            }
        }

            List<Integer> integers = ans.get(ans.size()-1);
            System.out.println(integers.toString());



    }

    public  static void qiangdu(int x1,int y1,int towerlength,int radius,int[] x,int[] y,int[] q){
       double qiangdu=0;
       int max_x=0;
       int max_y=0;
        for (int i = 0; i < towerlength; i++) {
            double d=Math.sqrt((x1-x[i])*(x1-x[i])+(y1-y[i])*(y1-y[i]));
            if (d<=radius){
                qiangdu+=q[i]/(1+d);
            }
        }

     if (qiangdu>=max_point){
         ans.add(Arrays.asList(x1,y1));
     }



    }


}
